﻿
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>


<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="${pageContext.request.contextPath }/shoppingadmin/favicon.ico">
    <link href="${pageContext.request.contextPath }/shoppingadmin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/shoppingadmin/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <!-- Data Tables -->
    <link href="${pageContext.request.contextPath }/shoppingadmin/css/dataTables.bootstrap.css" rel="stylesheet">

    <link href="${pageContext.request.contextPath }/shoppingadmin/css/animate.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/shoppingadmin/css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5> 一级分类 <small></small></h5>
                        <div class="ibox-tools">
                            
                            <a href="${pageContext.request.contextPath }/classification/toadd_One_Classificatio.html">
                        		 <button type="button" class="btn btn-default btn-xs" >添加</button>
                        	</a>
                            
                        </div>
                    </div>
                    <div class="ibox-content">

                        <table class="table table-striped table-bordered table-hover dataTables-example">
                            <thead>
                                <tr>
                                	<th>名称</th>
                                    <th>类型</th>
                                    <th style="text-align: center;">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            <c:forEach var="list" items="${list}">
                            	<tr class="gradeX">
                                    <td>${list.one_name }</td>
                                    <td>一级分类
                                    </td>
                                    
                                	<td class="center" style="text-align: center;">
                                		
                                			
	                                		<a href="to_add_two_Classification.html?id=${list.id}" title="添加子分类">
		                                    	<button class="btn  btn-info" style="margin-bottom: 0px;padding: 0px 5px;">
		                                    		<i class="fa fa-plus" aria-hidden="true"></i>
		                                    	</button>
		                                    </a>&nbsp;
                                		
	                                    <a href="to_update_One_Classification.html?id=${list.id}" title="编辑">
	                                    	<button class="btn  btn-info" style="margin-bottom: 0px;padding: 0px 5px;">
	                                    		<i class="fa fa-pencil-square-o" aria-hidden="true"></i>
	                                    	</button>
	                                    </a>&nbsp;
	                                     <a href="javascript:;" title="删除">
	                                       <input type="hidden" value="${list.id}"/>
	                                  	  	<button id="delete" class="btn btn-info delete1" style="margin-bottom: 0px;padding: 0px 5px;">
	                                  	  		<i class="fa fa-trash-o" aria-hidden="true"></i>
	                                  	  	</button>
	                                    </a>
	                                    <span style="color:red;" >${error }</span>
                                    </td>
                                </tr>
                            	
                            	</c:forEach>
                            	
                            	
                            	
                            	
                            	
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 全局js -->
    <script src="${pageContext.request.contextPath }/shoppingadmin/js/jquery.min.js?v=2.1.4"></script>
    <script src="${pageContext.request.contextPath }/shoppingadmin/js/bootstrap.min.js?v=3.3.6"></script>

    <script src="${pageContext.request.contextPath }/shoppingadmin/js/jquery.jeditable.js"></script>

    <!-- Data Tables -->
    <script src="${pageContext.request.contextPath }/shoppingadmin/js/jquery.dataTables.js"></script>
    <script src="${pageContext.request.contextPath }/shoppingadmin/js/dataTables.bootstrap.js"></script>

    <!-- 自定义js -->
    <script src="${pageContext.request.contextPath }/shoppingadmin/js/content.js?v=1.0.0"></script>

    <!-- Page-Level Scripts -->
    <script>
        $(document).ready(function () {
        	$(".delete1").click(function () {
        		var id=$(this).prev().val();
        		if(confirm("确定删除吗？")){
        			window.location.href="${pageContext.request.contextPath }/classification/del_One_Classification.html?id="+id;
        			return true;
        		}else{
        			return false;
        		}
            });
        	
            $('.dataTables-example').dataTable();

            /* Init DataTables */
            var oTable = $('#editable').dataTable();

            /* Apply the jEditable handlers to the table */
            oTable.$('td').editable('../example_ajax.php', {
                "callback": function (sValue, y) {
                    var aPos = oTable.fnGetPosition(this);
                    oTable.fnUpdate(sValue, aPos[0], aPos[1]);
                },
                "submitdata": function (value, settings) {
                    return {
                        "row_id": this.parentNode.getAttribute('id'),
                        "column": oTable.fnGetPosition(this)[2]
                    };
                },

                "width": "90%",
                "height": "100%"
            });


        });

        function fnClickAddRow() {
            $('#editable').dataTable().fnAddData([
                "Custom row",
                "New row",
                "New row",
                "New row",
                "New row"]);
        }
    </script>
</body>
</html>